package com.admin.education.dataTransferObject.subject.Mapper;

import com.admin.education.dataTransferObject.subject.Request.CreateSubjectRequest;
import com.admin.education.dataTransferObject.subject.Request.UpdateSubjectRequest;
import com.admin.education.dataTransferObject.subject.SubjectTransfer;
import com.admin.education.models.Subjects;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public abstract class SubjectMapper {
    @Mappings({})
    public abstract SubjectTransfer mapFrom(Subjects subjects);

    @Mappings({})
    public abstract Subjects mapFrom(CreateSubjectRequest createSubjectRequest);

    @Mappings({})
    public abstract List<SubjectTransfer> mapFrom(List<Subjects> subjects);

    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "questions", ignore = true),
            @Mapping(target = "templateQuestions", ignore = true),
            @Mapping(target = "userAnswerSheetQuestions", ignore = true)
    })
    public abstract Subjects mapFrom(UpdateSubjectRequest updateSubjectRequest, @MappingTarget Subjects subjects);
}
